package com.qf.listeners;

import com.qf.utils.ExcutorsUtils;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;
import java.util.concurrent.Executors;
@WebListener
public class ApplicaitonContextListener  implements ServletContextListener {
    @Override
    public void contextInitialized(ServletContextEvent sce) {
        System.out.println("线程启动了");
        ExcutorsUtils.setExecutorService(Executors.newScheduledThreadPool(10));
    }

    public void contextDestroyed(ServletContextEvent sce){
        ExcutorsUtils.shutdown();
    }
}
